#include "stdafx.h"
#include "YProactorTokenOnCancelIO.h"
#include "ITcpSessionCallback.h"
#include "ITcpSession.h"

namespace ysimple_network
{
	YProactorTokenOnCancelIO::YProactorTokenOnCancelIO(void)
		: m_pCallback(nullptr)
		, m_pSession(nullptr)
	{
	}


	YProactorTokenOnCancelIO::~YProactorTokenOnCancelIO(void)
	{
	}


	bool YProactorTokenOnCancelIO::init( ICancelIOCallback& callback, ITCPSession& session )
	{
		resetOverlapped();
		m_pCallback = &callback;
		m_pSession = &session;
		return true;
	}


	bool YProactorTokenOnCancelIO::onCompleted( bool completionStatus, LONG_PTR completionKey, DWORD dwBytesTransfered )
	{
		m_pCallback->onCanceled(*m_pSession);
		return true;
	}

}

